#!/bin/bash
POD_IP=$(cat /etc/hosts | grep tax-uat-deploy-base-app-merge | awk '{print $1}')

declare -A ports=(
    [8080]="tenant"
    [9090]="tenant-api"
    [9990]="tenant-api"
    [8081]="admin"
    [9091]="admin-api"
    [8082]="base"
    [9092]="base-api"
    [9093]="job-api"
    [9094]="logservice-api"
    [9991]="logservice-api"
    [9095]="mail-api"
    [9992]="mail-api"
    [9096]="message-api"
    [8083]="sys"
    [9097]="sys-api"
    [9098]="proxy-server-api"
)

for port in "${!ports[@]}"; do
    curl -s --connect-timeout 3 $POD_IP:$port > /dev/null
    if [ $? -ne 0 ]; then
        echo -e "\e[31m ${ports[$port]}\t\t$port\t\tis not accessible \e[0m"
    fi
done
